using System.Activities.Presentation;
using Headsight.BPMN2WF.BPMN.Model;
using Headsight.BPMN2WF.Testing.TestObjCtors;
using Headsight.BPMN2WF.Transformation.Transformers.Additions;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Headsight.BPMN2WF.Transformation.Transformers.NoGoodName
{
    [TestClass]
    public class BPMN2WFTransformationContextTest
    {
        private IBPMN2WFTransformationContext _sut;
        private BPMNFlowNodesBlock _process;
        private WorkflowDesigner _wfDesginer;
        private IBPMN2WFTransformations _transformations;

        [TestInitialize]
        public void SetUp()
        {
            _wfDesginer = new WorkflowDesignerCtor().Create();
            _transformations = new BPMN2WFTransformations4TestingCtor().Create();
            _process = new BPMNProcessCtor().Create();


            _sut = new BPMN2WFTransformationContext
                       {
                           BPMN2WFTransformations = _transformations, 
                           BPMNProcess = _process, 
                           WorkflowDesigner = _wfDesginer 
                       };
        }

        [TestMethod]
        public void WorkflowDesigner()
        {
            Assert.AreSame(_wfDesginer, _sut.WorkflowDesigner);
        }

        [TestMethod]
        public void BPMNProcess()
        {
            Assert.AreSame(_process, _sut.BPMNProcess);
        }

        [TestMethod]
        public void BPMN2WFTransformationMappings()
        {
            Assert.AreSame(_transformations, _sut.BPMN2WFTransformations);
        }

        [TestMethod]
        public void BPMNTransformationResults()
        {
            var actual1 = _sut.BPMNTransformationResults;
            var actual2 = _sut.BPMNTransformationResults;

            Assert.IsNotNull(actual1);
            Assert.IsNotNull(actual2);

            var bpmnFlowNode = new BPMNFlowNodeCtor().Create();
            var bpmnTransformationResult = new BPMNTransformationResultCtor().Create();

            actual1[bpmnFlowNode] = bpmnTransformationResult;
            Assert.AreSame(bpmnTransformationResult, actual2[bpmnFlowNode]);
        }
    }
}